package com.share.one.b_di;

import javax.annotation.PostConstruct;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class BookServiceImpl implements BookService {
	//之前方法
//	BookDao bookDao = new BookDaoImpl();
	
	//DI:setter()+property
//	private BookDao bookDao;
//	public void setBookDao(BookDao bookDao) {
//		this.bookDao = bookDao;
//	}
	
	//DI:注解
	@Autowired
	BookDao bookDao;
	
	@PostConstruct
	public void put() {
		System.out.println("@PostConstruct");
	}

	public void addBook() {
		bookDao.save();
	}
	
	public BookServiceImpl() {
		System.out.println("被new了");
	}

}
